#
# Try to find FREEIMAGE library and include path.
# Once done this will define
#
# FREEIMAGE_FOUND
# FREEIMAGE_INCLUDE_PATH
# FREEIMAGE_LIBRARY
# 

IF (WIN32)
	FIND_PATH( FREEIMAGE_INCLUDE_DIR FreeImage.h
		$ENV{PROGRAMFILES}/FreeImage/include
		$ENV{FREEIMAGE_DIR}/source/
		DOC "The directory where FreeImage.h resides")
	FIND_LIBRARY( FREEIMAGE_LIBRARY
		NAMES FreeImage freeimage
		PATHS
		$ENV{PROGRAMFILES}/FreeImage/lib
		$ENV{FREEIMAGE_DIR}/Dist/
		DOC "The FREEIMAGE library")
	FIND_LIBRARY( FREEIMAGE_LIBRARY_DEBUG
		NAMES FreeImaged freeimaged
		PATHS
		$ENV{PROGRAMFILES}/FreeImage/lib
		$ENV{FREEIMAGE_DIR}/Dist/
		DOC "The FREEIMAGE library")
ELSE (WIN32)
	FIND_PATH( FREEIMAGE_INCLUDE_DIR FreeImage.h
		/usr/include
		/usr/local/include
		/sw/include
		/opt/local/include
		DOC "The directory where FreeImage.h resides")
	FIND_LIBRARY( FREEIMAGE_LIBRARY
		NAMES FREEIMAGE freeimage
		PATHS
		/usr/lib64
		/usr/lib
		/usr/local/lib64
		/usr/local/lib
		/sw/lib
		/opt/local/lib
		DOC "The FreeImage library")
ENDIF (WIN32)

IF (FREEIMAGE_INCLUDE_DIR)
	SET( FREEIMAGE_FOUND 1 CACHE STRING "Set to 1 if FreeImage is found, 0 otherwise")
ELSE (FREEIMAGE_INCLUDE_DIR)
	SET( FREEIMAGE_FOUND 0 CACHE STRING "Set to 1 if FreeImage is found, 0 otherwise")
ENDIF (FREEIMAGE_INCLUDE_DIR)

MARK_AS_ADVANCED( FREEIMAGE_FOUND )

